export function getUrlParam(name) {
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  var u = window.location.search.substr(1);
  var r = u.match(reg);  //匹配目标参数
  if (r != null) return unescape(r[2]);
  return null; //返回参数值
}

export function getHashUrlParam(name) {
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  var temp = window.location.hash.split('?');
  var u = temp.length?temp[1]:null;
  var r = u.match(reg);  //匹配目标参数
  if (r != null) return unescape(r[2]);
  return null; //返回参数值
}

export function isWeChat() {
  return navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == "micromessenger";
}

export function isIphone() {
  return navigator.userAgent.toLowerCase().match(/iphone os/i) == "iphone os";
}

export function isAndroid() {
  return navigator.userAgent.toLowerCase().match(/android/i) == "android";
}

